#!/bin/bash
for ((i=0; i<$2;i++))
do
    /usr/bin/time -f "%e" -o time -a mpirun -np $1 ./bin/paralelo < files/input1.txt > files/saida
done

time=0
time_now=0
all_times=$(cat time)

for item in $all_times
do
    time_now=$item
    time=$(echo "scale=5; $time + $time_now" | bc)
done

time=$(echo "scale=5; $time / $2"| bc)
echo "Media de $2 execucoes do paralelo com $1 processos: $time"
rm time
